package com.phuonghoang.adapter;

import java.util.List;

import com.phuonghoang.model.RssItem;
import com.phuonghoang.vnexpress.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class NewAdapter extends ArrayAdapter<RssItem> {
	private Context context;
	private List<RssItem> items;
	private int ivIcon;
	public NewAdapter(Context context, int ivIcon,
			List<RssItem> items) {
		super(context, ivIcon, items);
		this.context=context;
		this.ivIcon=ivIcon;
		this.items=items;
	}


	


	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		@SuppressWarnings("static-access")
		LayoutInflater layoutInflater = (LayoutInflater) context
				.getSystemService(context.LAYOUT_INFLATER_SERVICE);
		View rowView = layoutInflater
				.inflate(R.layout.newlayout, parent, false);
		ImageView image = (ImageView) rowView.findViewById(R.id.ivCon);
		TextView text = (TextView) rowView.findViewById(R.id.tvNew);
		image.setImageResource(ivIcon);
		text.setText(items.get(position).getTitle());
		return rowView;
	}
}
